import Requset from "@/utils/request";

export const registerService = (registerData) => {
	const params = new URLSearchParams();
	// delete registerData.rePassword;
	for (let key in registerData) {
		params.append(key, registerData[key]);
	}
	return Requset.post("/user/register", params);
};

export const loginService = (registerData) => {
	const params = new URLSearchParams();
	// delete registerData.rePassword;
	for (let key in registerData) {
		params.append(key, registerData[key]);
	}
	return Requset.post("/user/login", params);
};

//获取个人信息
export const userInfoGetService = () => {
	return Requset.get("/user/userInfo");
};

//修改个人信息
export const userInfoUpdateService = (userInfo) => {
	return Requset.put("/user/update", userInfo);
};

//修改头像
export const userAvatarUpdateService = (avatarUrl) => {
	let params = new URLSearchParams();
	params.append("avatarUrl", avatarUrl);
	return Requset.patch("/user/updateAvatar", params);
};
